#pragma once

#include <SFML/Graphics.hpp>

/**
\class Input
\brief Format the input for easier use.
\author Plomeg
\date Map. 15th 2013
\version 0.2
**/
class Input
{

public:
	/**
	\enum Key
	\brief All the keys used in game.
	KeysCount is not used as a key but allow to count them.
	**/
	enum Key{Up_Arrow, Down_Arrow, Left_Arrow, Right_Arrow, Debug_Key, KeysCount};

	Input();

	/**
	\brief Check the state of a key.
	\param k The key to check.
	\return The state of the key.
	**/
	bool isKeyDown(Key k) const;

	/**
	\brief Update the key state
	\param k The key to update.
	\param isDown The state to update.

	This function already uses formated keys from the game so it requires another
	function to translate the events from SFML into Key.
	**/
	void updateKey(Key k, bool isDown);
	
	/**
	\brief Update with an event from SFML.
	\param event The event that occured.

	This function converts events from SFML into events of the game and update 
	the state of the input.
	**/
	void pushEvent(sf::Event event);
	
	/**
	\brief Convert a key from SFML to Key.
	\param keyIn the key to convert
	\param keyOut the key converted, if recognized
	\return true if the key is recognized, false else
	This function converts events from SFML into events of the game and update 
	the state of the input.
	**/
	bool convertKey(sf::Keyboard::Key keyIn, Key& keyOut);
private:

	/**
	\brief Represent the state of the keys.
	**/
	bool m_keyDown[KeysCount];
};
